#!/bin/bash
cat number1_of_sample.txt | tr "\n" " " > newnumber1.file
cat number2_of_sample.txt | tr "\n" " " > newnumber2.file
read -a array1 < newnumber1.file
read -a array2 < newnumber2.file
dir=$(ls *.gz)
for dirname in $dir
do
		newdirname=$(echo $dirname | cut -d ":" -f1)
		dirname1=$(echo $newdirname | cut -d "_" -f1)
		dirname2=$(echo $newdirname | cut -d "_" -f3)
		for (( i=0; i<=463; i++ ))
		do		
			var1=$(echo ${array1[$i]} | cut -b 1-8)
			var2=${array2[$i]}
			if [ $var1 = $dirname1 ]
		    then 
			   mv $newdirname $var2\_$dirname2
		    fi
		done
done

